package com.maiji.cloud.utils;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringUitl {

    /**
     * 正则表达式截取字符串
     * @param str
     * @param regex
     * @return
     */
    static public List<String> subsStringWithRegex(String str, String regex) {
        List<String> list = new ArrayList<>();
        Pattern pattern = Pattern.compile(regex);
        Matcher m = pattern.matcher(str);
        while (m.find()) {
            int i = 1;
            list.add(m.group(i));
            i++;

        }
        return list;
    }
}
